package com.shadt.cloud.dao.impl;



import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.shadt.cloud.dao.BranchMDao;
import com.shadt.core.dao.impl.BaseDaoImpl;

/**
 * 分平台权限数据访问层实现类
 * @author SongR
 *
 */
@SuppressWarnings("rawtypes")
@Repository
public class BranchMDaoImpl extends BaseDaoImpl implements BranchMDao{

	/**
	 * 修改状态
	 * @param id 关联ID
	 * @param status 状态
	 */
	public int update(int branch_id,int id,int status) {
		String sql = "UPDATE cms_cloud_branch a INNER JOIN cms_cloud_branch_channel b ON  a.branch_id=b.branch_id SET a.branch_status=0,b.status="+status+" WHERE a.branch_id="+branch_id+" and b.id="+id+"";
		return getJdbcTemplate().update(sql);
	}

	public List<Map<String, Object>> login(String name,String password) {
		String sql = "select * from cms_cloud_admininfo where name='"+name+"' and password='"+password+"'";
		return getJdbcTemplate().queryForList(sql);
	}
}
